/*******************************************************************************
* CSCI321 Major Project 2010 - University of Wollongong                        *
********************************************************************************
* Program:		WeaveEdit                                              *
* Authors:		Simon Allen (Student#: 3457527, Unix: sa655)           *
*			Scott Bellis (Student#: 3479110, Unix: sjb900)         *
*			Jason Benger (Student#: 3454137, Unix: jb960)          *
*			Timothy Newmarch (Student#: 3459263 Unix: tgn336)      *
*			Benjamin Richardson (Student# 3467752, Unix: bjr401)   *
* Supervisor:		Daniel F. Saffioti                                     *
* Modified:		28/10/2010                                             *
* Description:		WeaveEdit is a highly portable collaborative text      *
*			editor and word processor, allowing several users to   *
*			read and edit multiple documents at the same time.     *
*			It is available for Mac OS X, Windows and Linux,       *
*			utilising Nokia's Qt development framework.            *
*******************************************************************************/


#include "gotoline.h"
#include "ui_gotoline.h"


GoToLine::GoToLine(QWidget *parent) : QDialog(parent), ui(new Ui::GoToLine)
{
	ui->setupUi(this);
}

GoToLine::~GoToLine()
{
	delete ui;
}

/**
  * Get the line to go to.
  */
int GoToLine::getValue() const
{
	return ui->spinBox_line->value();
}

/**
  * Show the modal dialog with a value spinbox max of the number of lines in the document
  * and the current (focused) value of the current line number.
  */
int GoToLine::exec(const int numLines, const int currentLine = 1)
{
	ui->spinBox_line->setMaximum(numLines);
	ui->spinBox_line->setValue(currentLine);
	ui->spinBox_line->setFocus();

	return QDialog::exec();
}
